<template>
  <div class="my_msg">
    <div class="title">
      <van-icon name="arrow-left" size="0.33rem" @click="return_home" />
      <span>个人信息</span>
    </div>

    <ul>
      <li>
        <span>头像</span>
        <div>
<!--          <img src="./head_show.png" />-->
            <img :src="loginAdmin.headPic" style="border-radius: 30px"/>
<!--            <van-icon name="arrow" size="0.33rem" />-->

<!--          <img :src="loginAdmin.headPic" />-->
<!--          <van-icon name="arrow" size="0.33rem" />-->
        </div>
<!--        <span>{{loginAdmin.headPic}}</span>-->
<!--        <div>-->
<!--          <img src="./head_show.png" />-->
<!--          <van-icon name="arrow" size="0.33rem" />-->
<!--        </div>-->
      </li>

      <li>
        <span>账号</span>
        <span>{{loginAdmin.username}}</span>
      </li>

      <li>
        <span>姓名</span>

        <span>{{loginAdmin.name}}</span>
      </li>

      <li>
        <span>证件</span>

        <span>{{loginAdmin.credentialsType}}</span>
      </li>

      <li>
        <span>证件号</span>

        <span>{{loginAdmin.idNumber}}</span>
      </li>

      <li>
        <span>手机号</span>
        <span>{{loginAdmin.phoneNum}}</span>
      </li>
        <li>
            <span>实名认证</span>
            <van-button type="warning" size="mini" @click="smrz()">实名认证</van-button>
        </li>
    </ul>

    <p>
      <img src="./also.png" />
      手机号变更需本人携带身份证到门店办理
    </p>
    <div style="margin-bottom: 20px">
      <button style="color: #f5ffb5" @click="editUser">修改个人信息</button>
    </div>
      <div>
          <button @click="outlogin">退出登录</button>
      </div>
  </div>
</template>

<script>
// import { user } from "../../request/home/userinfo";
export default {
    props: {},
    data() {
        return {
            loginAdmin: {},
        };
    },


    created() {
        this.initUserInfo();
    },
    mounted() {

    },
    methods: {
    editUser(){
        this.$router.push({path:'/editUser'})
    },
    smrz(){
        if (this.loginAdmin.pathFront == null && this.loginAdmin.pathReverse==null){
            this.$router.push({path:'/rz'})
        }else {
            this.$message.success('已实名认证成功');
        }
    },
     outlogin() {
         this.$http.get("/client/api/logout").then(result => {
             if (result.data.code===200) {
                 this.$message.success(result.data.msg);
                 this.$router.push('/login')
             }
         })
     },
    initUserInfo(){
      this.$http.get("/client/api/info").then(result=>{
        console.log(result)
        if(result.data.code === 200){
          this.loginAdmin = result.data.data;
            this.$store.state.user = this.loginAdmin
            // localStorage.setItem('loginAdmin',result.data.data.username);
        }
      })
    },
    return_home() {
      this.$router.go(-1);
    },
  },
  components: {},
};
</script>

<style scoped lang="less">
.my_msg {
  .title {
    padding: 0 0.24rem;
    display: flex;
    align-items: center;
    height: 0.88rem;
    box-shadow: 0 0.06rem #f3f3f3;

    span {
      flex: 1;
      text-align: center;
      font-size: 0.34rem;
    }
  }

  ul {
    font-size: 0.27rem;
    margin-bottom: 0.38rem;

    li {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0 0.24rem;
      height: 0.99rem;
      border-bottom: 1px solid #e0e0e0;
      div {
        display: flex;
        justify-content: space-between;
        align-items: center;
        img {
          width: 0.8rem;
          height: 0.8rem;
          margin-right: 0.21rem;
        }
      }
    }
  }

  p {
    img {
      width: 0.2rem;
      height: 0.2rem;
    }
    padding: 0 0.24rem;
    text-align: right;
    font-size: 0.17rem;
    color: #b3b3b3;
    margin-bottom: 1rem;
  }

  div {
    text-align: center;
    button {
      width: 5rem;
      height: 1rem;
      color: #fff;
      font-size: 0.36rem;
      text-align: center;
      line-height: 1rem;
      background: #3d88f7;
      border: none;
      outline: none;
      border-radius: 0.09rem;
    }
  }
}
</style>
